package com.channelsharing.hongqu.supplier.api.weixin;

import com.channelsharing.common.entity.model.TemplateData;
import com.channelsharing.common.entity.model.WxMssVo;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeixinTemplateMessage {
    public void sendTemplateMessage(String accessToken,String templateId,String openId, String formId, String page, List<TemplateData> list ) {
        WxMssVo wxMssVo = new WxMssVo();
        wxMssVo.setTemplate_id(templateId);
        wxMssVo.setTouser(openId);
        wxMssVo.setPage(page);
        wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + accessToken);
        wxMssVo.setForm_id(formId);
        wxMssVo.setParams(list);
        TemplateMessageUtil.sendTemplateMessage(wxMssVo);
    }
}
